
export function throttle(fn, delay) {
  let timer
  const throttle = function () {
    if (timer) {
      return
    }
    timer = setTimeout(function () {
      fn()
      timer = null
    }, delay)
  }
  return throttle
}